import React, { Component } from 'react';
import './index.css'

class List extends Component {

    render() {
        console.log(this.props)
        return (
        
            <div className="row">
            {
                this.props.isFirst? <h3 align="center">暂无数据显示</h3> :
                this.props.isLoading? <h2>Loading...........</h2> :
                this.props.error!=null? <h2 style={{color:'red'}}>发生异常:{this.props.error.message}</h2> :
                this.props.users.map((user)=>{
                    return (
                        <div className="card" key={user.id}>
                        <a href={user.html_url} target="_blank" rel="noreferrer">
                        <img alt="head_photo" src={user.avatar_url} style={{width: '100px'}}/>
                        </a>
                        <p className="card-text">{user.login}</p>
                    </div>
                    )
                })
            }
            </div>
             
        )
       
    }
}

export default List;